
cc.Class({
    extends: cc.Component,

    properties: {
        dragon: {
            default: null,
            tooltip: "龙的节点",
            type: cc.Node
        }
    },

    _sendEvent() {
        this.dragon.emit('TOUCH_START', {
            msg: '可以触发事件了....',
        });
    },

    _addTouchEvent() {
        let self = this;
        self.node.on(cc.Node.EventType.TOUCH_START, function (event) {
            cc.log("触摸事件...TOUCH_START");
            self._sendEvent();
        }, self);
        self.node.on(cc.Node.EventType.TOUCH_MOVE, function (event) {
            cc.log("触摸事件...TOUCH_START");
        }, self);
        self.node.on(cc.Node.EventType.TOUCH_END, function (event) {
            cc.log("触摸事件...TOUCH_END");
        }, self);

        self.node.on(cc.Node.EventType.MOUSE_DOWN, function (event) {
            cc.log("鼠标事件...MOUSE_DOWN");
            self._sendEvent();
        }, self);

        cc.log("已注册事件....");
    },

    onLoad() {
        this._addTouchEvent();
    },

    // start() {

    // },

    // update (dt) {},
});
